<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <head th:include="common/common_head :: commonHead('导入记录流水管理')"></head>
</head>
<body class="auth-user">
<div class="layui-fluid">
    <div class="layui-row larryms-panel auth-user-add">
        <form class="layui-form" id="importLogForm">
            <input type="hidden" id="id" name="id" th:value="${entity?.id}"/>
            <div class="layui-form-item">
                <label for="deptId" class="layui-form-label">
                    <span class="x-red">*</span> 部门id                 </label>
                <div class="layui-input-block">
                        <input type="text" id="deptId" name="deptId" lay-verify="deptId"
                               autocomplete="off" class="layui-input larry-input" th:value="${entity?.deptId}"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="templateId" class="layui-form-label">
                    <span class="x-red">*</span> 模板id                 </label>
                <div class="layui-input-block">
                        <input type="text" id="templateId" name="templateId" lay-verify="templateId"
                               autocomplete="off" class="layui-input larry-input" th:value="${entity?.templateId}"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="createTime" class="layui-form-label">
                    <span class="x-red">*</span> 导入时间                 </label>
                <div class="layui-input-block">
                        <input type="text" id="createTime" name="createTime" lay-verify="createTime"
                           autocomplete="off" class="layui-input larry-input" th:value="${entity?.createTime} == null ? '' : ${#dates.format(entity?.createTime, 'yyyy-MM-dd HH:mm:ss')}"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="createUser" class="layui-form-label">
                    <span class="x-red">*</span> 操作人                 </label>
                <div class="layui-input-block">
                        <input type="text" id="createUser" name="createUser" lay-verify="createUser"
                               autocomplete="off" class="layui-input larry-input" th:value="${entity?.createUser}"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="status" class="layui-form-label">
                    <span class="x-red">*</span> 状态（0：成功；1：失败）                 </label>
                <div class="layui-input-block">
                        <input type="text" id="status" name="status" lay-verify="status"
                               autocomplete="off" class="layui-input larry-input" th:value="${entity?.status}"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="remark" class="layui-form-label">
                    <span class="x-red">*</span> 备注                 </label>
                <div class="layui-input-block">
                        <input type="text" id="remark" name="remark" lay-verify="remark"
                               autocomplete="off" class="layui-input larry-input" th:value="${entity?.remark}"/>
                </div>
            </div>
    <div th:if="${param.detail == null}">
        <div class="larryms-layer-btn">
            <a class="layui-btn layui-btn layui-btn-sm left" lay-submit=""
               lay-filter="add" id="submit" th:attr="data-url=@{/admin/importLog/save}">保存</a>
            <a class="layui-btn layui-btn layui-btn-sm  layui-btn-danger" id="resetBtn">重置</a>
            <a class="layui-btn layui-btn layui-btn-sm  layui-btn-primary" id="close">关闭</a>
        </div>
    </div>
    </form>
    </div>
</div>
<script type="text/javascript" th:src="@{/static/larryms/layui/layui.js}"/>
<script type="text/javascript" th:inline="javascript">/*<![CDATA[*/
var bathPath = /*[[@{/}]]*/ "/";
layui.config({
    version: ui.version,
    layertype:2,
    base: bathPath + 'static/larryms/',  //实际使用时，建议改成绝对路径
    rightMenu: "none" // false关闭，设置为custom时使用自定义，不使用默认menu
}).extend({
    larry:'js/base'
}).use(['larry','form','table','laydate','custom'], function () {
    var form = layui.form , larryms = layui.larryms, $ = layui.$, beone = layui.custom;
    var formRules = {};
            formRules.deptId = function (value) {
                if (value.trim() == "") {
                    return  "部门id不能为空!" ;
                }
            }
            formRules.templateId = function (value) {
                if (value.trim() == "") {
                    return  "模板id不能为空!" ;
                }
            }
            layui.laydate.render({  id:"createTime", elem:"#createTime"});
            formRules.createTime = function (value) {
                if (value.trim() == "") {
                    return  "导入时间不能为空!" ;
                }
            }
            formRules.createUser = function (value) {
                if (value.trim() == "") {
                    return  "操作人不能为空!" ;
                }
            }
            formRules.status = function (value) {
                if (value.trim() == "") {
                    return  "状态（0：成功；1：失败）不能为空!" ;
                }
            }
            formRules.remark = function (value) {
                if (value.trim() == "") {
                    return  "备注不能为空!" ;
                }
            }
    //自定义验证规则
    form.verify(formRules);

    var indexFre = parent.layer.getFrameIndex(window.name);
    $('#close').click(function () {
        parent.layer.close(indexFre);
    });
    $('#resetBtn').on('click', function() {
        $('#importLogForm')[0].reset();
    });
    //监听提交
    form.on('submit(add)', function (data) {
        var url = $(this).data("url");
        $.post(url, data.field, function(res) {
            if (res.code == "success") {
                larryms.msg(res.desc);
                parent.table.reload('importLogList', {});
                parent.layer.close(indexFre);
            }
        });
        return false;
    });
    form.render();
});
/*]]>*/</script>
</body>
</html>